package org.lex.keytool;

import java.awt.Component;
import java.awt.Container;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.JFrame;
import javax.swing.JScrollPane;

public class Swings {

	public static void show(Component c) {
		Container pane = null;
		if (c instanceof JScrollPane) {
			pane = (Container) c;
		} else {
			pane = new JScrollPane(c);
		}

		final JFrame f = new JFrame();
		f.setContentPane(pane);
		f.setSize(375, 400);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.addComponentListener(new ComponentAdapter() {
			@Override
			public void componentResized(ComponentEvent e) {
				f.setTitle("[" + f.getWidth() + ", " + f.getHeight() + "]");
			}
		});
		f.setLocationRelativeTo(null);
		f.setVisible(true);
	}
}
